package com.framework.entity;

import com.framework.entity.base.BapBaseTimeEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.Type;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.UUID;

/**
 * @Description: 分片文件存储实体类
 * @Author: JamesYao
 * @DateTime: 2024/1/16 23:24
 */

@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Table(name = "chunk_file")
public class ChunkFile extends BapBaseTimeEntity {

    @Comment("当前文件唯一标识符")
    @Column(name = "file_id",nullable = false,length = 128)
    private String fileId;

    @Comment("文件序列号")
    @Column(length = 16)
    private int num;

    @Comment("文件加密后的SHA256")
    @Column(length = 256)
    private String hash;

    @Comment("当前文件总块数")
    @Column(length = 16)
    private int count;

    @Comment("文件存储路径")
    @Column(length = 256)
    private String path;

    @Comment("父id（对应存储的完整文件）")
    @Type(type = "uuid-char")
    @Column(length = 128)
    private UUID pid;
}
